const hanshu = {
  textEach: (string, n) => {
    if(string.length>n){
      string = string.substring(0,n)+'...'
    }
    return string
  },
  regCheck: (string,reg) => {
    if(reg.test(string)){
      return true
    }
    return false
  },
  judge: () => {
    if (window.ActiveXObject || "ActiveXObject" in window) {
      //判断是否为IE浏览器，"ActiveXObject" in window判断是否为IE11
      //判断是否安装了adobe Reader
      for (x = 2; x < 10; x++) {
        try {
          oAcro = eval("new ActiveXObject('PDF.PdfCtrl." + x + "');");
          if (oAcro) {
            flag = true;
          }
        } catch (e) {
          flag = false;
        }
      }
      try {
        oAcro4 = new ActiveXObject('PDF.PdfCtrl.1');
        if (oAcro4) {
          flag = true;
        }
      } catch (e) {
        flag = false;
      }

      try {
        oAcro7 = new ActiveXObject('AcroPDF.PDF.1');
        if (oAcro7) {
          flag = true;
        }
      } catch (e) {
        flag = false;
      }

      if (flag) {//支持
        // this.pdfShow(url);//调用显示的方法
        return true

      }else {//不支持
        // $("#pdfContent").append("对不起,您还没有安装PDF阅读器软件呢,为了方便预览PDF文档,请选择安装！");
        alert("对不起,您还没有安装PDF阅读器软件呢,为了方便预览PDF文档,请选择安装！");
        location = "http://ardownload.adobe.com/pub/adobe/reader/win/9.x/9.3/chs/AdbeRdr930_zh_CN.exe";
      }

    }else {
      return true
      // this.pdfShow(url);//调用显示的方法
      // $("#PDFBox").addClass('active')
    }
  }
}

export default hanshu
